
import { Row, Col } from 'antd'
import { useEffect, useState } from 'react';
import { useParams, useHistory } from 'react-router-dom'

import {
  addCreatePatient,
  addUpdatePatient,
  getPatientDetail,
  getOrganizeList,
  getOrganizeCreate,
  getOrganizeUpdate
} from '@/services/register';

import {
  payTypeSchema,
  receiveMethodSchema,
  payStatusSchema
} from '@/utils/schema'


import {
  arrayFormatObj
} from '@/utils/index'

import styles from './index.module.less'

export default () => {
  const [state, setState] = useState<ProFieldFCMode>('read');
  const [plain, setPlain] = useState<boolean>(false);
  const [data, setData] = useState<any>(null);

  const params = useParams();
  const history = useHistory();

  async function init() {
    const res = await getPatientDetail({ id: params?.id });
    console.log('res :>> ', res?.data);
    setData(res?.data)
  }

  useEffect(() => {
    init()
  }, [])

  function goBack() {
    history.push('/register/registerList');
  }

  const receiveMethodObj = arrayFormatObj(receiveMethodSchema.options)
  console.log('receiveMethodObj :>> ', receiveMethodObj);

  return (
    <div className={styles.main}>
      <Row gutter={[16, 16]}>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.flex}>
              <div className={styles.userLeft}>
                {/* <div>
                  <div className={styles.userImgBox}>
                    <img src={data?.cardPicture} alt='' />
                  </div>
                  <div>用户照片</div>
                </div> */}
                <div>
                  <div className={styles.userImgBox}></div>
                  <div>用户头像</div>
                </div>
              </div>
              <div className={styles.userRight}>
                <div className={styles.lineBox}>
                  <div className={styles.blod}>姓名：{data?.name}</div>
                  <div>备注名：{data?.name}</div>
                  <div>性别：{data?.gender == "1" ? '女' : '男'}</div>
                  <div>生日：{data?.birthday}</div>
                  <div>身高：{data?.height}cm</div>
                  <div>体重：{data?.weight}kg</div>
                </div>
                <div className={styles.lineBox}>
                  <div>证件类型：身份证</div>
                  <div>证件号：{data?.cardID}</div>
                </div>
                <div className={styles.lineBox}>
                  <div>注册昵称：</div>
                  <div>用户ID：{data?.id}</div>
                  <div>手机号：{data?.phoneNum}</div>
                  <div>邮箱：{data?.email}</div>
                </div>
                <div className={styles.lineBox}>
                  <div>所属分组：{data?.tyGroupName}</div>
                </div>
              </div>
            </div>
          </div>
        </Col>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>默认取药方式</div>
            <div>取药方式：{data?.receiveMethod && receiveMethodObj[data?.receiveMethod]?.label}</div>
          </div>
        </Col>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>常居地</div>
            <div>{data?.city} {data?.province} {data?.region} {data?.address}</div>
          </div>
        </Col>
        {/* <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>用药特性</div>
            <div>--</div>
          </div>
        </Col>

        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>基础健康信息</div>
            <div>血型:--</div>
            <div>疾病史 (含外伤) :--</div>
            <div>预防接种:--</div>
            <div>过敏史:--</div>
            <div>传染病史:--</div>
            <div>手术史: --</div>
            <div>输血史:--</div>
            <div>用药史:--</div>
            <div>残疾情况:--</div>
            <div>婚育史:--</div>
            <div>月经史:--</div>
          </div>
        </Col>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>社会信息</div>
            <div>受教育程度:--</div>
            <div>职业类别:--</div>
            <div>职业:--</div>
            <div>家庭月收入:--</div>
            <div>婚姻状况:--</div>
          </div>
        </Col>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>其它备注</div>
            <div>--</div>
          </div>
        </Col>
        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>紧急联系人</div>
            <div>紧急联系人:--</div>
            <div>紧急联系人关系:.</div>
            <div>紧急联系人电话: +86-.</div>
            <div>紧急联系人邮箱:--</div>
          </div>
        </Col>

        <Col span={8}>
          <div className={styles.box}>
            <div className={styles.blod}>建档信息</div>
            <div>建档日期: 2023-11-06</div>
            <div>建档人:{data?.tyOrganizeName}</div>
            <div>建档机构:{data?.tyGroupName}</div>
            <div>推荐人:--</div>
          </div>
        </Col> */}
      </Row>
      <div className={styles.goBack} onClick={goBack}>返回</div>
    </div>
  );
};
